﻿using System;
using System.Collections;
using NHibernate.Engine;
using NHibernate.Context;

namespace Caramel.NHibernate
{
	public class LocalStorageSessionContext : MapBasedSessionContext
	{
		public LocalStorageSessionContext(ISessionFactoryImplementor factory)
			: base(factory)
		{
		}

		protected override IDictionary GetMap()
		{
			return LocalStorage.Current;
		}

		protected override void SetMap(IDictionary value)
		{
			throw new NotSupportedException("Cannot write LocalStorage.Current.");
		}
	}
}
